package com.daodaofun.util;

import java.util.ArrayList;
import java.util.List;

public class PageInfo<T> {


    public static final int PAGE_SIZE_FANS = 10;

    /**
     * 分页大小
     */
    private Integer pageSize = 10;


    /**
     * 当前页码
     */
    private Integer pageNum;


    /**
     * 总条数
     */
    private Long total;

    /**
     * 总页数
     */
    private Long pages;

    private List<T> list = new ArrayList<>();

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public Long getPages() {
        return total % pageSize == 0 ? total/pageSize : (total/pageSize + 1);
    }

//    public void setPages(Long pages) {
//        this.pages = pages;
//    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
